竞赛
考级
#include<bits/stdc++.h> using namespace std; const int N=300; char st[N]; int si=0,k; string str; int main(){ cin>>str>>k; for(int i=0;i<str.size();i++){ while(si>0&&k>0&&st[si]>str[i]) si--,k--; st[si]=str[i]; } while(k>0){si--;k--;} bool f0=true; for(int i=1;i<=si;i){ if(st[i]=='0'&&f0)continue; else{ f0=false; cout<<st[i]; } } if(f0)cout<<0<<endl; else cout<<endl; return 0; }
133****8670
https://www.acgo.cn/application/1679077056631783424
吴东润
#include<bits/stdc++.h> using namespace std; void move(int n,char a,char c,char b){ if(n==0)return; move(n-1,a,b,c); printf("%c --%d--> %c\n",a,n,c); move(n-1,b,c,a); } int main(){ int n; scanf("%d",&n); move(n,'A','C','B'); return 0; }
#include<bits/stdc++.h> using namespace std; const int N=1e5+10; int a[N]; long long sum=0; int main(){ int n,x; cin>>n; for(int i=1;i<=n;i++)cin>>a[i]; cin>>x; for(int i=1;i<=x;i++)sum+=a[i]; cout<<sum; return 0; }
共18864条